package com.svc.template.ui.base;


import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

public abstract class DefaultSubscriber<T> implements Observer {
    private BaseView view;
    private Disposable disposable;
    public DefaultSubscriber(BaseView view){
        this.view = view;
    }

    @Override
    public void onSubscribe(Disposable d) {
        disposable = d;
    }

    @Override
    public void onError(Throwable e) {
        view.showErrorTip(e.getMessage());
        disposable.dispose();
    }

    @Override
    public void onComplete() {
        view.stopLoading();
    }
}
